#include "grayscale.h"
#define FRAME_LENGTH 6

#define delay_ms(X)     delay_cycles( (CPUCLK_FREQ/1000) * (X) )
No_MCU_Sensor sensor;
unsigned short Anolog[8]={0};
unsigned short white[8]={3150,3150,3150,3150,3150,3150,3150,3150};
unsigned short black[8]={1110,1110,1110,1110,1110,1110,1110,1110};
unsigned short Normal[8];
unsigned char Digtal = 0;
char str[256]={0};

void sensor_init(void){
	//初始化传感器，不带黑白值
	No_MCU_Ganv_Sensor_Init(&sensor, white, black);
	No_Mcu_Ganv_Sensor_Task_Without_tick(&sensor);
	delay_ms(100);
}

void read_data(void){
    No_Mcu_Ganv_Sensor_Task_Without_tick(&sensor);
    Digtal=Get_Digtal_For_User(&sensor);
    
}

void white_jiaozhun(void) {
    No_Mcu_Ganv_Sensor_Task_Without_tick(&sensor);
    Get_Anolog_Value(&sensor, Anolog);
}

void black_jiaozhun(void){
    No_Mcu_Ganv_Sensor_Task_Without_tick(&sensor);
    Get_Anolog_Value(&sensor, Anolog);
}
